package com.zk.mall.servlet;

import com.zk.mall.entity.Admin;
import com.zk.mall.service.AdminService;
import com.zk.mall.service.impl.AdminServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class selFlagByIdServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id= Integer.parseInt(req.getParameter("adminid"));

        AdminService adminService=new AdminServiceImpl();
        Admin admin=adminService.selFlagById(id);
        if (admin.getAdminflag()==1){
            req.getRequestDispatcher("showAdmin.jsp").forward(req,resp);
        }else {}

    }
}
